import os
import openai
from langchain_community.llms import OpenAI
from langchain.chains import LLMChain
from langchain_core.prompts import PromptTemplate

os.environ["OPENAI_API_KEY"]=os.environ["OPENAI_API_KEY_ZHIHU"]
os.environ["OPENAI_API_BASE"]=os.environ["OPENAI_API_BASE_ZHIHU"]
llm = OpenAI(model_name= "gpt-3.5-turbo",temperature=0.9)

prompt = '''Answer the question based on the context below: If the 
question cannot be answered using the information provided answer with "I don't know".

Context:Large Language Models(LLMs) are the latest models used in NLP.
There superior performance over smaller models has made them incredibly 
useful for developers building NLP enabled applications. These models
can be accessed via Hugging face's 'transformers' library, via OpenAI
using the 'openai' library, and via Cohere using the 'cohere' library.

Question: {query}
'''

prompt_template = PromptTemplate(input_variables=["query"],template=prompt)
llm_chain = LLMChain(prompt=prompt_template,llm=llm)

query = "Which libraries and model providers offer LLMs?"
print(llm_chain.run(query))